package com.djsearch.adapter;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.djsearch.R;
import com.djsearch.adapter.JingdianAdapter.ViewHolder;

public class NearByAdapter extends BaseAdapter {
	private Context mContext;

	public NearByAdapter(Context context) {
		mContext = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 20;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder;

		if (convertView == null) {
			LayoutInflater layoutInflater = ((Activity) mContext)
					.getLayoutInflater();
			convertView = layoutInflater.inflate(R.layout.nearby_item,
					parent, false);
			holder = new ViewHolder();
			holder.jingdianImage = (ImageView) convertView
					.findViewById(R.id.image);
		} else {
			convertView = (View) convertView.getTag();
		}
		return convertView;
	}

	public static class ViewHolder {
		ImageView jingdianImage;
	}
}
